// 使用2个栈实现一个队列，完成队列的push 和pop 队列中的元素为 int类型


class Cqueuq<T> {
  private inStarck: T[] = []
  private outStack: T[] = []

  appendTail(value: T) {
    this.inStarck.push(value)
  }

  deleteHead() {
    const { inStarck, outStack } = this
    if (outStack.length) {
      return outStack.pop()
    } else {
      for (let i = inStarck.length - 1; i > 0; i--) {
        const x = inStarck[i]
        outStack.push(x)
      }
      inStarck.splice(0, Infinity)
      return outStack.pop()
    }
  }

}

